Skip to content

feat(sfs): add snapshot_policy_id to sfs_resource_pool#1444

Open
marceljk wants to merge 1 commit intomainfrom
feat/STACKITTPR-629-add-snapshot-policy-id-in-sfs-resource-pool
Open

feat(sfs): add snapshot_policy_id to sfs_resource_pool#1444
marceljk wants to merge 1 commit intomainfrom
feat/STACKITTPR-629-add-snapshot-policy-id-in-sfs-resource-pool

Conversation

@marceljk
Copy link
Copy Markdown
Contributor

@marceljk marceljk commented May 6, 2026

Description

relates to STACKITTPR-629

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@marceljk marceljk requested a review from a team as a code owner May 6, 2026 12:15
@marceljk marceljk force-pushed the feat/STACKITTPR-629-add-snapshot-policy-id-in-sfs-resource-pool branch from 6b2aaaf to 52faacd Compare May 6, 2026 12:23
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/sfs 0.00% (ø)
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/sfs/resourcepool 20.92% (+2.09%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/sfs/resourcepool/datasource.go 32.89% (+1.81%) 76 (+2) 25 (+2) 51 👍
github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/sfs/resourcepool/resource.go 17.27% (+2.31%) 249 (+15) 43 (+8) 206 (+7) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/sfs/resourcepool/datasource_test.go
  • github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/sfs/resourcepool/resource_test.go
  • github.com/stackitcloud/terraform-provider-stackit/stackit/internal/services/sfs/sfs_acc_test.go

Optional: true,
Default: objectdefault.StaticValue(
types.ObjectValueMust(snapshotPolicyTypes, map[string]attr.Value{
"id": types.StringValue(defaultSnapshotPolicyId),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would expect the API to return an error for an empty string value as a snapshot policy ID.

At least I didn't get any snapshot policy with id "" from https://docs.api.stackit.cloud/documentation/sfs/version/v1#operation/ListSnapshotPolicies

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API design is the one thing. But why to we send an empty string? I don't quite get it tbh 😅

Copy link
Copy Markdown
Contributor Author

@marceljk marceljk May 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The snapshot policy ID is in the PATCH request optional, but not nullable. So to remove the snapshot policy from an existing resource pool, we need to set it to an empty string. The empty string, is also the default "snapshot_policy_id", when no id was set within the creation.

I set it on default to an empty string, to automatically remove the snapshot_policy_id, when someone removes the object in their terraform config. Otherwise terraform wouldn't trigger an update

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the empty string thing is a workaround for an API issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants